package org.example.warehouse.service.impl;

import java.util.List;

import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.utils.ShiroUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.example.warehouse.mapper.WarehouseStoreMapper;
import org.example.warehouse.domain.WarehouseStore;
import org.example.warehouse.service.IWarehouseStoreService;
import com.ruoyi.common.core.text.Convert;

/**
 * 仓库存储Service业务层处理
 *
 * @author 小孟微信：xiaomengcode
 * @date 2024-04-12
 */
@Service
public class WarehouseStoreServiceImpl implements IWarehouseStoreService
{
    @Autowired
    private WarehouseStoreMapper warehouseStoreMapper;

    /**
     * 查询仓库存储
     *
     * @param warehouseStoreId 仓库存储主键
     * @return 仓库存储
     */
    @Override
    public WarehouseStore selectWarehouseStoreByWarehouseStoreId(Long warehouseStoreId)
    {
        return warehouseStoreMapper.selectWarehouseStoreByWarehouseStoreId(warehouseStoreId);
    }

    /**
     * 查询仓库存储列表
     *
     * @param warehouseStore 仓库存储
     * @return 仓库存储
     */
    @Override
    @DataScope(deptAlias = "d", userAlias = "u")
    public List<WarehouseStore> selectWarehouseStoreList(WarehouseStore warehouseStore)
    {
        return warehouseStoreMapper.selectWarehouseStoreList(warehouseStore);
    }

    /**
     * 新增仓库存储
     *
     * @param warehouseStore 仓库存储
     * @return 结果
     */
    @Override
    public int insertWarehouseStore(WarehouseStore warehouseStore)
    {
        warehouseStore.setCreateBy(ShiroUtils.getUserId()+"");
        return warehouseStoreMapper.insertWarehouseStore(warehouseStore);
    }

    /**
     * 修改仓库存储
     *
     * @param warehouseStore 仓库存储
     * @return 结果
     */
    @Override
    public int updateWarehouseStore(WarehouseStore warehouseStore)
    {
        return warehouseStoreMapper.updateWarehouseStore(warehouseStore);
    }

    /**
     * 批量删除仓库存储
     *
     * @param warehouseStoreIds 需要删除的仓库存储主键
     * @return 结果
     */
    @Override
    public int deleteWarehouseStoreByWarehouseStoreIds(String warehouseStoreIds)
    {
        return warehouseStoreMapper.deleteWarehouseStoreByWarehouseStoreIds(Convert.toStrArray(warehouseStoreIds));
    }

    /**
     * 删除仓库存储信息
     *
     * @param warehouseStoreId 仓库存储主键
     * @return 结果
     */
    @Override
    public int deleteWarehouseStoreByWarehouseStoreId(Long warehouseStoreId)
    {
        return warehouseStoreMapper.deleteWarehouseStoreByWarehouseStoreId(warehouseStoreId);
    }
}
